// 封装一个存储模块
const TokenKey = 'hm-mobile-79-token'
const Tistorykey = 'hm-mobile-79-history'

// 设置token
export const setToken = (tokenInfo) => {
  localStorage.setItem(TokenKey, JSON.stringify(tokenInfo))
}
// 获取token
export const getToken = () => {
  return JSON.parse(localStorage.getItem(TokenKey)) || {}
}
// 删除 token
export const removeToken = () => {
  localStorage.removeItem(TokenKey)
}

// 存储历史
export const setHistory = (history) => {
  localStorage.setItem(Tistorykey, JSON.stringify(history))
}
// 获取历史
export const getHistory = () => {
  return JSON.parse(localStorage.getItem(Tistorykey)) || []
}
// 移除历史
export const removeHistory = () => {
  localStorage.removeHistory(Tistorykey)
}
